import {
  defineConfig,
  presetAttributify,
  presetIcons,
  presetUno,
  transformerDirectives,
  transformerVariantGroup,
} from 'unocss'
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'

export default defineConfig({
  presets: [
    presetUno(),
    presetAttributify(),
    presetIcons({
      extraProperties: {
        display: 'inline-block',
        'vertical-align': 'middle',
        width: '1.2em',
        height: '1.2em',
      },
      // scale: 1.5,
      warn: true,
      collections: {
        custom: FileSystemIconLoader(
          './src/icons',
          svg => svg.replaceAll('class="icon"', '').replace(/^<svg /, '<svg fill="currentColor" '),
        ),
      },
    }),
  ],
  transformers: [
    transformerDirectives({
      applyVariable: ['--un-apply'],
    }),
    transformerVariantGroup(),
  ],
})
